package com.chaosj.tools.rules

import com.chaosj.tools.StockDiscoverTools

class SpanRule implements IAbnormalRule{
    @Override
    boolean execute(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        int index = stocks.size()-1
        if( stocks.get(index-2).dailyLimit() && stocks.get(index-1).span(1.15) && stocks.get(index).todayUp()>=0.97 ){
            println(description(stockName))
            return true
        }
        return false
    }

    @Override
    boolean support(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        return stocks.size()>=3
    }

    @Override
    String description(Object... desc) {
        return String.format("【%s】前天涨停,昨天跨度超过15个点,今天竞价在-3个点以内",desc)
    }
}
